package lk.icta.user.dao;

import lk.icta.common.entity.DSDivision;
import lk.icta.user.entity.User;

import java.util.List;

/**
 * @author Mahesha Kalpanie
 */
public interface UserDAO {

    /**
     * Add new user
     *
     * @param user the user to be added
     */
    public void addUser(User user);

    /**
     * Update a user
     *
     * @param user the updated user
     */
    public void updateUser(User user);

    /**
     * Get a list of all users (who are not deleted) - the results are not paged
     *
     * @return a List of all users
     */
    public List<User> getAllUsers();

    /**
     * Find a user from his/her userName
     *
     * @param userName
     * @return User corresponding to the given username
     */
    public User getUserByUserName(String userName);

    /**
     * Find a user from email address
     *
     * @param email email address of the user
     * @return User    corresponding to the given email
     */
    public User getUserByEmail(String email);

    /**
     * get  user list for each organization
     *
     * @param organizationId related organization id
     * @param user           user
     * @return ORPII user list
     */
    public List<User> getUsersByOrganization(int organizationId, User user);

    /**
     * get ORPII user list for each organization
     *
     * @param organizationId related organization id
     * @param user           user
     * @return ORPII user list
     */
    public List<User> getORPIIUsersByOrganization(int organizationId, User user);

    /**
     * New UR-MGOI user list for each organization
     *
     * @param organizationId related organization id
     * @param user           user
     * @return ORPII user list
     */
    public List<User> getNewURMGOIUsersByOrganization(int organizationId, User user);


    /**
     * filter users by user role
     *
     * @param role user role id
     * @return filtered user list  by user role
     */
    public List<User> getUsersByRole(String role);

    /**
     * Filter user by DS
     *
     * @param role role id of the user
     * @param dsId division id of the user
     * @param user requesting User for
     * @return filtered user list by user role
     */
    public List<User> getUsersByRoleDS(String role, int dsId, User user);


    /**
     * Filter user by Province
     *
     * @param role       role id of the user
     * @param provinceId division id of the user
     * @param user       requesting User for
     * @return filtered user list by user role
     */
    public List<User> getUsersByRoleProvince(String role, int provinceId, User user);

    public List<User> getAllUsersByPA(int dsId, User user);


}
